package com.hyh.music.mapper;

import com.github.pagehelper.Page;
import com.hyh.music.domain.domainDTO.SingerDTO;
import com.hyh.music.domain.domainDTO.SingerPageDTO;
import com.hyh.music.domain.domains.Singer;
import org.apache.ibatis.annotations.*;

/**
 * @author hyh
 * @version 1.0
 * 歌手
 */
@Mapper
public interface SingerMapper {
    /**
     * 歌手的分页查询
     * @param singerPageDTO
     * @return
     */
    Page<Singer> page(SingerPageDTO singerPageDTO);

    /**
     * 添加歌手
     * @param singerDTO
     */
    @Insert("insert into singer (name, sex, pic, birth, location, introduction) " +
            "values (#{name} , #{sex} , #{pic} , #{birth} ,#{location},#{introduction})")
    void add(SingerDTO singerDTO);
    /**
     * 删除歌手
     * @param id
     */
    @Delete("delete from singer where id = #{id}")
    void deleteSingerById(@Param("id") Integer id);
    /**
     * 根据id查询歌手
     * @param id
     * @return
     */
    @Select("select * from singer where id = #{id}")
    Singer selectById(@Param("id") Integer id);
    /**
     * 更新歌手数据
     * @param singer
     */
    void update(Singer singer);
}
